package com.apexsoft.test.sample.ams.controller;


import com.alibaba.fastjson.JSONObject;
import com.apexsoft.aas.util.security.AES;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;


@RestController
public class EncodeController {


    @Value("${demo.str}")
    private String value;

    @RequestMapping("encode1")
    public JSONObject encode1() {
        return new JSONObject() {{
            put("code", 1);
            put("note", "访问成功");
            put("value", value);
        }};

    }

    @RequestMapping("encode2")
    public JSONObject encode2() {
        String mw = AES.encrypt("2882828");
        String yw = AES.decrypt(mw);
        return new JSONObject() {{
            put("code", 1);
            put("note", "访问成功");
            put("密文", mw);
            put("原文", yw);
        }};

    }


}
